1. Technical Field
The present invention relates generally to graphic processing and more particularly, but not by way of limitation, to a method and system for producing high-quality anti-aliased graphic pictures at high frame rates with low computational cost.
2. History of Related Art
Real-time rendering of three-dimensional graphics has a number of appealing applications on mobile terminals, including games, man-machine interfaces, messaging, and e-commerce. Since three-dimensional rendering is typically a computationally expensive task, dedicated hardware must often be built to achieve acceptable performance. Innovative ways of lowering the computations complexity and bandwidth usage of this hardware architecture are thus of great importance. As described in Akenine-Möller, Tomas and Jacob Ström, “Graphics for the Masses: A Hardware Architecture for Mobile Phones,” ACM Transactions on Graphics, vol. 22, no. 3, Proceedings of ACMSIGGRAPH 2003, pp. 801-808, Jul. 2003, it has been shown that the average eye-to-pixel angle is about 2-4 greater for a mobile phone than for a personal computer (PC). Thus, the image quality on mobile devices should ideally be greater than for PCs. However, mobile devices typically have fewer and less-powerful computational resources.
Since the early days of computer graphics, aliasing has been a problem when presenting still or moving pictures on a display. An example of aliasing is the stair-step effect that is visible on display terminals when a line is drawn at an angle. These stair-step artifacts are commonly referred to as “jaggies”. During three-dimensional rendering, edges of polygons often produce noticeable aliasing artifacts. It is desirable to reduce these artifacts using anti-aliasing techniques.
One approach to reducing the artifacts in pictures due to aliasing is to use what is known as supersampling. In a supersampling approach, a scene is sampled in more than one point per pixel to be displayed and the final image is computed from the samples. As a special case of supersampling, multisampling techniques also sample the scene in more than one point per pixel, but the results of fragment shader computations (e.g. texture and color) are shared between the samples in a pixel. A multisampling algorithm, in general, is one that takes more than one sample per pixel in a single pass, and shares computations among the samples for a grid cell.
In the supersampling approach to anti-aliasing, a picture is rendered at a higher resolution than the final resolution that is displayed on the screen, resulting in more than one sample per pixel. The samples for each pixel are then averaged, for example, to form the color of the pixel. This is done by rendering multiple sub-pixel samples for each pixel to be displayed, and computing the value of each pixel as a weighted sum of the sub-pixel sample values. For example, each displayed pixel may be comprised of a filtered, weighted sum of a group of four sub-pixel samples inside the pixel.
As a consequence of the supersampling approach, the graphics hardware must process four times as many samples for each displayed pixel. This method of anti-aliasing is often referred to as brute-force supersampling. Brute-force supersampling increases the quality of the image greatly, but comes at a high penalty in terms of memory and rendering time. For example, assume that the width and height of a target image is w×h. If a resolution of 2 w×2 h is used for brute-force supersampling, then four samples per pixel are used, and four times as much memory, as well as four times the rasterization time, is required. Although supersampling provides good picture quality, it may result in a low frame rate due to a heavy computational burden.
In order to lower the computational burden for producing anti-aliased pixels, a modified supersampling scheme may be used in which sub-pixel sample locations are placed in positions so that the value of one or more of the sample locations may be used for calculating the final value for more than one pixel. A supersampling scheme of this kind is often referred to as a sample-sharing scheme. By sharing samples, it is possible to obtain less than four samples per pixel. Multisampling can sometimes be used to further reduce bandwidth requirements, since part of the computations may be shared by all samples inside a pixel.
The GeForce3™ graphics processing unit from NVIDIA Corporation, Santa Clara, USA provides hardware that supports supersampling and sharing of subsamples between pixels. A supersampling scheme is referred to as “Quincunx” presents a sub-pixel sample pattern in the form of a “5” on a die (i.e., five sub-pixel samples are used for calculating the value of the final pixel). Due to the placing of the sample locations in the Quincunx scheme, only two samples per pixel need to be calculated. The rest of the sample values are obtained from neighboring pixels. A center sub-pixel sample is given a weight of 0.5, while peripheral sub-pixel samples are given a weight of 0.125 each. Information regarding the Quincunx scheme may be found in “Technical Brief, HRAA: High-Resolution Antialiasing through Multisampling” from NVIDIA Corporation.
A number of gray levels between black and white in a monochrome scheme depends on how many pixel sample points are used. In an example in which four pixel sample locations are used, there will at best be three gray shades between black and white. Consequently, the Quincunx scheme described above at best provides four shades of gray. However, the effective number of gray shades for the Quincunx scheme may be as low as two. In the Quincunx scheme, the sample points form lines in vertical, horizontal, and 45° directions, which causes the Quincunx scheme to perform worse than some other schemes for some line orientations.